// home.js
var config = require('../../config');
var util=require('../../js/util');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    books:[]
  },
  openSearch: function () {
    wx.navigateTo({ url: '../search-book/search-book' });
  },

  openBook: function () {
    wx.navigateTo({ url: '../bookinfo/bookinfo' });
  },

  openScan: function () {
    wx.scanCode({
      success: (res) => {
        var bookid=res.result;
        wx.navigateTo({
          url:'../rentbook/rentbook?bookid='+bookid
        })
      }
    })
  },
  openBookInfo: function (event) {
    var isbn = event.currentTarget.dataset.isbn;
    console.log(isbn);
    var url ='..//bookinfo/bookinfo?isbn='+isbn;
    wx.navigateTo({
      url: '../bookinfo/bookinfo?isbn='+isbn,
    })
  },
  openMyRent:function(event){
    wx.navigateTo({
      url: '../myrent/myrent',
    })
  },
  openNavigation:function(event){
    wx.navigateTo({
      url: '../navigation/navigation',
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    wx.request({
      url: 'https://55300249.qcloud.la/JapariFriends/searchBook?condition1=BookId<25',
      success: function (res) {
        that.setData({
          books:res.data
        })
      }
    })

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

 
})